<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>订单 | </title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <!--<link href="css/nprogress.css" rel="stylesheet">-->
    <!-- FullCalendar -->
    <link href="css/fullcalendar.min.css" rel="stylesheet">
    <link href="css/fullcalendar.print.css" rel="stylesheet" media="print">
    <style>

    	#bbb{
    		margin: 2px 90px;
    		float: left;
    		display: none;
    	}
    </style>


    <!-- Custom styling plus plugins -->
    <link href="css/custom.min.css" rel="stylesheet">
  </head>

  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
       <div id="head">

       </div>



        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
              <div class="title_left">
              	<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
               <div class="input-group">
                <input type="text" id="ordernum" class="form-control" placeholder="订单号">
                    <span class="input-group-btn">
                      <a href="javascript:;" class="btn btn-default page1" >搜索</a>
                    </span>

                      </div>

                         </div>
              </div>

              <div class="title_right"	style="margin-top: 8px;">
                    <!-- <h3>右边数据<small>Click to add/edit events</small></h3>-->
                     	<!--<a href="http://www.baidu.com"></a>-->
                     	<a class="collapse-link" id="gsearch"><i class="fa fa-chevron-up">高级搜索</i></a>

              </div>
              <div class="row" id="bbb">
              		<div style="margin-left: 1000px;">
              				<a href="javascript:;" class="btn btn-info page2">开始搜索</a>
              			</div>
              	<form>
              					<div class="row" style="margin-bottom: 8px;">
                          <label class="col-sm-1 control-label" style="text-align: right;" for="ORDER_NUMBER">订单号：</label>
                          <div class="col-sm-2">
                             <input class="form-control" id="ORDER_NUMBER" type="text" />
                          </div>
                          <label class="col-sm-1 control-label" style="text-align: right;" for="SHIPPING_TYPE">订单类型：</label>
                          <div class="col-sm-2">
                             <select id="SHIPPING_TYPE"  class="form-control">
                                 <option value="">请选择</option>
                             	<option value="1">海运</option>
                             	<option value="2">空运</option>
                             </select>
                          </div>
                          <label class="col-sm-1 control-label" style="text-align: right;" for="SALESMANID">业务员：</label>
                          <div class="col-sm-2">
                          	<select id="SALESMANID"  class="form-control">
                                <!--<option value="">请选择</option>-->
                             </select>
                          </div>

                       </div>
                       <div class="row" style="margin-bottom: 8px;">

                           <label class="col-sm-1 control-label" style="text-align: right;" for="CUSTOMER_ID">客户：</label>
                          <div class="col-sm-2">
                             <input class="form-control"  id="CUSTOMER_ID" type="text" />
                          </div>
                           <label class="col-sm-1 control-label" style="text-align: right;" for="CREATETIME">创建日期从：</label>
                          <div class="col-sm-2">
                             <input class="form-control" id="CREATETIME" type="date" />
                          </div>
                           <label class="col-sm-1 control-label" style="text-align: right;" for="ORDERTIME">创建日期到：</label>
                           <div class="col-sm-2">
                               <input class="form-control"  id="ORDERTIME" type="date" />
                           </div>
                       </div>

    										</form>
    									</div>


            </div>

            <div class="clearfix"></div>

            <div class="row">
              <div class="col-md-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>订单跟踪</h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>


                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">

                    <p></p>

                    <!-- start project list -->
                    <table class="table table-striped projects" id="table1">
                      <thead>
                        <tr>
                          <th style="width: 6%">排序</th>
                          <th style="width: 7%">订单号</th>
                          <!--<th style="width: 7%">订舱申请号</th>-->
                          <th style="width: 12%">客户名称<br>出口组织</th>
                          <th style="width: 8%">联系电话</th>
                          <th style="width: 20%">区域业务员</th>
                          <th style="width: 6%">运输方式</th>
                          <th style="width: 10%">订单接入日期</th>
                          <th style="width: 6%">状态</th>
                          <th style="width: 12%">操作</th>
                        </tr>
                      </thead>

                    </table>
                    <!-- end project list -->

                  </div>
                </div>
              </div>
          </div>
        </div>
        <!-- /page content -->

        <!-- footer content -->

          <div class="pull-right" style="margin-bottom: 5px;	" >
							<ul class="pagination" id="ye">

							</ul>
          </div>
          <!--<div class="clearfix"></div>-->
        <!-- /footer content -->
      </div>
    </div>

    <!-- calendar modal -->
    <div id="CalenderModalNew" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">

          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h4 class="modal-title" id="myModalLabel">New Calendar Entry</h4>
          </div>
          <div class="modal-body">
            <div id="testmodal" style="padding: 5px 20px;">
              <form id="antoform" class="form-horizontal calender" role="form">
                <div class="form-group">
                  <label class="col-sm-3 control-label">Title</label>
                  <div class="col-sm-9">
                    <input type="text" class="form-control" id="title" name="title">
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-3 control-label">Description</label>
                  <div class="col-sm-9">
                    <textarea class="form-control" style="height:55px;" id="descr" name="descr"></textarea>
                  </div>
                </div>
              </form>
            </div>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default antoclose" data-dismiss="modal">Close</button>
            <button type="button" class="btn btn-primary antosubmit">Save changes</button>
          </div>
        </div>
      </div>
    </div>
    <div id="CalenderModalEdit" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog">
        <div class="modal-content">

          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h4 class="modal-title" id="myModalLabel2">Edit Calendar Entry</h4>
          </div>
          <div class="modal-body">

            <div id="testmodal2" style="padding: 5px 20px;">
              <form id="antoform2" class="form-horizontal calender" role="form">
                <div class="form-group">
                  <label class="col-sm-3 control-label">Title</label>
                  <div class="col-sm-9">
                    <input type="text" class="form-control" id="title2" name="title2">
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-3 control-label">Description</label>
                  <div class="col-sm-9">
                    <textarea class="form-control" style="height:55px;" id="descr2" name="descr"></textarea>
                  </div>
                </div>

              </form>
            </div>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default antoclose2" data-dismiss="modal">Close</button>
            <button type="button" class="btn btn-primary antosubmit2">Save changes</button>
          </div>
        </div>
      </div>
    </div>

    <div id="fc_create" data-toggle="modal" data-target="#CalenderModalNew"></div>
    <div id="fc_edit" data-toggle="modal" data-target="#CalenderModalEdit"></div>
    <!-- /calendar modal -->
    </div>
    <!-- jQuery -->
    <script src="js/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="js/fastclick.js"></script>
    <!-- NProgress -->
    <script src="js/nprogress.js"></script>
    <!-- FullCalendar -->
    <script src="js/moment.min.js"></script>
    <script src="js/fullcalendar.min.js"></script>
    <script src="js/icheck.min.js"></script>

    <!-- Custom Theme Scripts -->
    <!--<script src="js/custom.min.js"></script>-->

		<style >
			.checkbox-custom {
    position: relative;
    padding: 0 15px 0 25px;
    margin-bottom: 7px;
    margin-top: 0;
    display: inline-block;
}
/*
将初始的checkbox的样式改变
*/
.checkbox-custom input[type="checkbox"] {
    opacity: 0;/*将初始的checkbox隐藏起来*/
    position: absolute;
    cursor: pointer;
    z-index: 2;
    margin: -6px 0 0 0;
    top: 50%;
    left: 3px;
}
/*
设计新的checkbox，位置
*/
.checkbox-custom label:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    margin-top: -9px;
    width: 19px;
    height: 18px;
    display: inline-block;
    border-radius: 2px;
    border: 1px solid #bbb;
    background: #eee;
}
/*
点击初始的checkbox，将新的checkbox关联起来
*/
.checkbox-custom input[type="checkbox"]:checked +label:after {
    position: absolute;
    display: inline-block;
    font-family: 'Glyphicons Halflings';
    content: "\e013";
    top: 48%;
    left: 4px;
    margin-top: -5px;
    font-size: 11px;
    line-height: 1;
    width: 16px;
    height: 16px;
    color: #333;
}
.checkbox-custom label {
    cursor: pointer;
    line-height: 1.2;
    font-weight: normal;/*改变了rememberme的字体*/
    margin-bottom: 0;
    text-align: left;
}

		</style>
    <!-- FullCalendar -->
    <script>


      $(window).load(function() {
      	$("#head").load("head.html");
      	$("#gsearch").click(function(){
 					 $("#bbb").toggle();
				});

        var date = new Date(),
            d = date.getDate(),
            m = date.getMonth(),
            y = date.getFullYear(),
            started,
            categoryClass;

        var calendar = $('#calendar').fullCalendar({
          header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
          },
          selectable: true,
          selectHelper: true,
          select: function(start, end, allDay) {
            $('#fc_create').click();

            started = start;
            ended = end;

            $(".antosubmit").on("click", function() {
              var title = $("#title").val();
              if (end) {
                ended = end;
              }

              categoryClass = $("#event_type").val();

              if (title) {
                calendar.fullCalendar('renderEvent', {
                    title: title,
                    start: started,
                    end: end,
                    allDay: allDay
                  },
                  true // make the event "stick"
                );
              }

              $('#title').val('');

              calendar.fullCalendar('unselect');

              $('.antoclose').click();

              return false;
            });
          },
          eventClick: function(calEvent, jsEvent, view) {
            $('#fc_edit').click();
            $('#title2').val(calEvent.title);

            categoryClass = $("#event_type").val();

            $(".antosubmit2").on("click", function() {
              calEvent.title = $("#title2").val();

              calendar.fullCalendar('updateEvent', calEvent);
              $('.antoclose2').click();
            });

            calendar.fullCalendar('unselect');
          },
          editable: true,
          events: [{
            title: 'All Day Event',
            start: new Date(y, m, 1)
          }, {
            title: 'Long Event',
            start: new Date(y, m, d - 5),
            end: new Date(y, m, d - 2)
          }, {
            title: 'Meeting',
            start: new Date(y, m, d, 10, 30),
            allDay: false
          }, {
            title: 'Lunch',
            start: new Date(y, m, d + 14, 12, 0),
            end: new Date(y, m, d, 14, 0),
            allDay: false
          }, {
            title: 'Birthday Party',
            start: new Date(y, m, d + 1, 19, 0),
            end: new Date(y, m, d + 1, 22, 30),
            allDay: false
          }, {
            title: 'Click for Google',
            start: new Date(y, m, 28),
            end: new Date(y, m, 29),
            url: 'http://google.com/'
          }]
        });
      });

            function   formatDate(now)   {
                var   year=now.getFullYear();
                var   month=now.getMonth()+1;
                var   date=now.getDate();
                return   year+"-"+month+"-"+date;
            }
            var $token=window.sessionStorage.getItem('token');
            <!--页面初始化ajax-->
            var formDate=new FormData();
            formDate.append("token",$token);
            $.ajax({
                type:"post",
                cache:false,
                processData:false,
                contentType:false,
                xhrFields:{withCredentials:true},
                url:"http://localhost:8081/OrderController/sys_Receipt",
                dataType:"json",
                data:formDate,
                success:function (data) {
                    if(data.list==null){
                        $("#table1").html('<td id="noData_td" colspan="7">未查到数据</td>');
                        return;
                    }
                    $("#noData_td").hide();
                    $('#table1 tbody').remove();
                    $('#ye li').remove();
                    $.each(data.list,function(i,order) {
                        var $tr = $('<tr></tr>');

                        var $td = $('<td></td>');
                        $td.text(i+1);
                        $tr.append($td);

                        var $td = $('<td></td>');
                        $td.text(order.orderNumber);
                        $tr.append($td);

                        var $td = $('<td></td>');
                        $td.text(order.senderName+"/"+order.goodDescription);
                        $tr.append($td);
                        $td = $('<td></td>');
                        $td.text(order.aPhone);
                        $tr.append($td);
                        $td = $('<td></td>');
                        $td.text(order.sname);
                        $tr.append($td);

                        $td = $('<td></td>');
                        if (order.shippingType==1){
                            $td.text("海运");
                        }else if(order.shippingType==2){
                            $td.text("空运");
                        }
                        $tr.append($td);


                        var $ordertime=new Date(order.createtime);
                        $td = $('<td></td>');
                        $td.text(formatDate(new Date($ordertime)));
                        $tr.append($td);

                        $td = $('<td></td>');
                        if (order.statusid==1||order.statusid==21||order.statusid==11||order.statusid==4||order.statusid==6 ){
                            $td.html('<button type="button" class="btn btn-danger btn-xs">'+order.typeName+'</button>');
                        }else{
                            $td.html('<button type="button" class="btn btn-success btn-xs">'+order.typeName+'</button>');
                        }
                        $tr.append($td);

                        $td = $('<td></td>');
                        $td.html('<a href="sys_order_info.html?oid='+order.orderNumber+'" orderNumber="'+order.orderNumber+'"   class="btn btn-primary btn-xs "  >查看</a>\n');
                        $tr.append($td);
                        $('#table1').append($tr);

                    })
                    $('#ye').prepend('<li><a class="page1" href="javascript:;" pageNum="'+(data.pageNum-1)+'" >&laquo;</a></li >');
                    $("#ye").append('<li><a>'+data.pageNum+"/"+data.pages+'</a></li>');
                    $('#ye').append('<li><a class="page1" href="javascript:;" pageNum="'+(data.pageNum+1)+'">&raquo;</a></li>');
                },
                error:function(){
                    alert("错误");
                }
            })
      $.ajax({
          type:"post",
          xhrFields:{withCredentials:true},
          url:"http://localhost:8081/OrderController/salman",
          dataType:"json",
          data:{"token":$token},
          success:function (data) {
              $("#SALESMANID option").remove();
              $("#SALESMANID").append('<option value="">请选择</option>');
              $.each(data, function (i, order) {
                  $("#SALESMANID").append('<option value="'+order.id+'">'+order.sName+'</option>');
              })
          },
          error:function(){
              alert("错误");
          }
      })
            <!--end页面初始化ajax-->

            $(document).on("click",".page1",function () {
               var $ordernum= $("#ordernum").val();
                var $pagenum = $(this).attr("pagenum");
                var formDate = new FormData();
                formDate.append("token", $token);
                formDate.append("orderNumber", $ordernum);
                if($pagenum!=undefined){
                    formDate.append("pageNum", $pagenum);
                }

                $.ajax({
                    type: "post",
                    cache: false,
                    processData: false,
                    contentType: false,
                    xhrFields: {withCredentials: true},
                    url: "http://localhost:8081/OrderController/sys_Receipt",
                    dataType: "json",
                    data: formDate,
                    success: function (data) {
                        if (data.list == null) {
                            $("#table1").html('<td id="noData_td" colspan="7">未查到数据</td>');
                            return;
                        }
                        $("#noData_td").hide();
                        $('#table1 tbody').remove();
                        $('#ye li').remove();
                        $.each(data.list, function (i, order) {
                            var $tr = $('<tr></tr>');

                            var $td = $('<td></td>');
                            $td.text(i + 1);
                            $tr.append($td);

                            var $td = $('<td></td>');
                            $td.text(order.orderNumber);
                            $tr.append($td);

                            var $td = $('<td></td>');
                            $td.text(order.senderName+"/"+order.goodDescription);
                            $tr.append($td);
                            $td = $('<td></td>');
                            $td.text(order.aPhone);
                            $tr.append($td);
                            $td = $('<td></td>');
                            $td.text(order.sname);
                            $tr.append($td);

                            $td = $('<td></td>');
                            if (order.shippingType == 1) {
                                $td.text("海运");
                            } else if (order.shippingType == 2) {
                                $td.text("空运");
                            }
                            $tr.append($td);


                            var $ordertime = new Date(order.createtime);
                            $td = $('<td></td>');
                            $td.text(formatDate(new Date($ordertime)));
                            $tr.append($td);

                            $td = $('<td></td>');
                            if (order.statusid==1||order.statusid==21||order.statusid==11||order.statusid==4||order.statusid==6 ){
                                $td.html('<button type="button" class="btn btn-danger btn-xs">'+order.typeName+'</button>');
                            }else{
                                $td.html('<button type="button" class="btn btn-success btn-xs">'+order.typeName+'</button>');
                            }

                            $tr.append($td);

                            $td = $('<td></td>');
                            $td.html('<a href="sys_order_info.html?oid=' + order.orderNumber + '"   orderNumber="'+order.orderNumber+'" class="btn btn-primary btn-xs "  >查看</a>\n');
                            $tr.append($td);
                            $('#table1').append($tr);

                        })

                        $('#ye').prepend('<li><a class="page1" href="javascript:;" pageNum="' + (data.pageNum - 1) + '" >&laquo;</a></li >');
                        $("#ye").append('<li><a>' + data.pageNum + "/" + data.pages + '</a></li>');
                        $('#ye').append('<li><a class="page1" href="javascript:;" pageNum="' + (data.pageNum + 1) + '">&raquo;</a></li>');
                    },
                    error: function () {
                        alert("错误");
                    }
                })
            })
            <!--end页面初始化ajax-->


            $(document).on("click",".page2",function () {
                var $ordernum= $("#ORDER_NUMBER").val();
                var $shippingType= $("#SHIPPING_TYPE").val();
                var $salesmanid= $("#SALESMANID").val();
                var $senderName= $("#CUSTOMER_ID").val();
                var $createtime= $("#CREATETIME").val();
                var $ordertime= $("#ORDERTIME").val();

                var $pagenum = $(this).attr("pagenum");
                var formDate = new FormData();
                formDate.append("token", $token);
                formDate.append("orderNumber", $ordernum);
                formDate.append("shippingType", $shippingType);
                formDate.append("salesmanid", $salesmanid);
                formDate.append("senderName", $senderName);
                if($createtime!=null&&$createtime!=''){
                    formDate.append("createtime", new Date($createtime));
                }
                if($ordertime!=null&&$ordertime!=''){
                    formDate.append("ordertime",new Date($ordertime));
                }
                if($pagenum!=undefined){
                    formDate.append("pageNum", $pagenum);
                }

                $.ajax({
                    type: "post",
                    cache: false,
                    processData: false,
                    contentType: false,
                    xhrFields: {withCredentials: true},
                    url: "http://localhost:8081/OrderController/sys_Receipt",
                    dataType: "json",
                    data: formDate,
                    success: function (data) {
                        if (data.list == null||data.list =='') {
                            $("#noData_td").remove();
                            $('#table1 tbody').remove();
                            $('#ye li').remove();
                            $("#table1").append('<td id="noData_td" colspan="7">未查到数据</td>');
                            // return;
                        }else{
                        $("#noData_td").hide();
                        $('#table1 tbody').remove();
                        $('#ye li').remove();
                        $.each(data.list, function (i, order) {
                            var $tr = $('<tr></tr>');

                            var $td = $('<td></td>');
                            $td.text(i + 1);
                            $tr.append($td);

                            var $td = $('<td></td>');
                            $td.text(order.orderNumber);
                            $tr.append($td);

                            var $td = $('<td></td>');
                            $td.text(order.senderName+"/"+order.goodDescription);
                            $tr.append($td);
                            $td = $('<td></td>');
                            $td.text(order.aPhone);
                            $tr.append($td);
                            $td = $('<td></td>');
                            $td.text(order.sname);
                            $tr.append($td);

                            $td = $('<td></td>');
                            if (order.shippingType == 1) {
                                $td.text("海运");
                            } else if (order.shippingType == 2) {
                                $td.text("空运");
                            }
                            $tr.append($td);


                            var $ordertime = new Date(order.createtime);
                            $td = $('<td></td>');
                            $td.text(formatDate(new Date($ordertime)));
                            $tr.append($td);

                            $td = $('<td></td>');
                            if (order.statusid==1||order.statusid==21||order.statusid==11||order.statusid==4||order.statusid==6 ){
                                $td.html('<button type="button" class="btn btn-danger btn-xs">'+order.typeName+'</button>');
                            }else{
                                $td.html('<button type="button" class="btn btn-success btn-xs">'+order.typeName+'</button>');
                            }
                            $tr.append($td);

                            $td = $('<td></td>');
                            $td.html('<a href="sys_order_info.html?oid=' + order.orderNumber + '" orderNumber="'+order.orderNumber+'"  class="btn btn-primary btn-xs "  >查看</a>\n');
                            $tr.append($td);
                            $('#table1').append($tr);

                        })
                        }
                        $('#ye').prepend('<li><a class="page2" href="javascript:;" pageNum="' + (data.pageNum - 1) + '" >&laquo;</a></li >');
                        $("#ye").append('<li><a>' + data.pageNum + "/" + data.pages + '</a></li>');
                        $('#ye').append('<li><a class="page2" href="javascript:;" pageNum="' + (data.pageNum + 1) + '">&raquo;</a></li>');
                    },
                    error: function () {
                        alert("错误");
                    }
                })
            })



    </script>
    <!-- /FullCalendar -->
  </body>
</html>
